//-----------------------------------------------------------------------------
/// STATE_MM_CONFIRM (Implementation)
//-----------------------------------------------------------------------------
START_STATE_CODE( STATE_MM_CONFIRM )
{
    START_MESSAGE_HANDLER( MESSAGE_ENTER )
    {
		InitMainMenuConfirm();
    }

    START_MESSAGE_HANDLER( MESSAGE_UPDATE )
    {		
		UpdateMainMenuConfirm();
    }

    START_MESSAGE_HANDLER( MESSAGE_PAINT )
    {
		PaintMainMenuConfirm(s_gBackBuffer);
    }

    START_MESSAGE_HANDLER( MESSAGE_EXIT )
    {

    }

	START_MESSAGE_HANDLER( MESSAGE_HIDENOTIFY )
	{
		// GameHideNotify();
	}
}

static void InitMainMenuConfirm()
{
	_dialog_item_focused = 0;
	InitConfirmDialog(_main_menu_dialog);
	SetSoftkey(false, false);
}

static void UpdateMainMenuConfirm()
{
	switch(s_iPressedKey)
	{
		case CanvasKeys.NUM2:
		case CanvasKeys.UP:
		case CanvasKeys.NUM8:
		case CanvasKeys.DOWN:
			_dialog_item_focused = 1 - _dialog_item_focused;
			break;
		default:
			break;
	}
	switch(s_iReleasedKey)
	{
		case CanvasKeys.NUM5:
		case CanvasKeys.SELECT:
			_dialog_item_selected = _main_menu_dialog[_dialog_item_focused + 1];
			switch(_dialog_item_selected)
			{
				case TEXT.MENU_YES:
					SwitchState(STATE_MAINMENU);
					break;
				case TEXT.MENU_NO:
					SwitchState(STATE_IGM);
					break;
				default:
					break;
			}
			break;
		default:
			break;
	}
}

static void PaintMainMenuConfirm(Graphics g)
{
	PaintDialogConfirm(g, _main_menu_dialog, true);
}

